home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstdio.arc / SRC.ARC / STRLEN.A < prev    next >
Text File  |  1985-08-20  |  430b  |  24 lines

  1. ;    strlen.a - return length of string.
  2. ;    (C) Copyright 1985 Cray Research Inc. - All Rights Reserved.
  3. ;    G. R. Mansfield.  85/08/20.
  4. ;    Ver 1.0-5820.
  5.  
  6.  
  7.     cseg
  8.     
  9.     public    strlen_
  10.  
  11. ;    int strlen(s)    /* return length of string s */
  12. ;    char *s;
  13.  
  14. strlen_:
  15.     mov    bx,sp
  16.     mov    si,[bx+2]    ; s
  17.     mov    cx,-1
  18. stl1:    lodsb            ; next character in s
  19.     inc    cx
  20.     or    al,al
  21.     jnz    stl1        ; loop to end of string
  22.     xchg    ax,cx        ; return length
  23.     ret
  24.